package com.che168.barchartdemo;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import com.che168.barchartdemo.utils.annotation.FindView;
import com.che168.barchartdemo.utils.annotation.ViewUtil;
import com.che168.barchartdemo.widget.BarChart.BarChartData;
import com.che168.barchartdemo.widget.BarChart.BarChartView;

import java.util.ArrayList;
import java.util.List;

/**
 * 图标demo
 *
 * @author zhudeshuai
 * @since 16/8/18
 */
public class MainActivity extends AppCompatActivity {

    @FindView(R.id.barCharView)
    private BarChartView mBarChartView;

    private List<BarChartData> mShowData = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ViewUtil.injectBaseView(this);
        initData();


    }

    private void initData() {
        mShowData.clear();
        for (int i = 0; i < 6; i++) {
            BarChartData data = new BarChartData();
            data.mName = "小明" + i;
            data.mData = (int) (Math.random() * 1000);
            mShowData.add(data);
        }
        mBarChartView.setShowData(mShowData);
    }

    public void change(View view) {
        initData();
    }
}
